package com.member.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.member.entity.Member;
import com.member.util.DBUtil;
public class MemberDAO {
	
		private Connection conn = null;
		PreparedStatement pstmt = null;
		Statement stmt = null;
		ResultSet rs = null;

		public MemberDAO() {
			conn = DBUtil.getConnection();
		}
		public boolean insertPersonInfo(Member user) throws SQLException {
			boolean flag = false;
			pstmt = (PreparedStatement) conn
					.prepareStatement("INSERT INTO ecom.user (Email,Password,Fname,Lname,Address,City,State,Country) VALUES(?,?,?,?,?,?,?,?)");

			int count = 0;
			pstmt.setString(1, user.getEmail());
			pstmt.setString(2, user.getPassword());
			pstmt.setString(3, user.getFname());
			pstmt.setString(4, user.getLname());
			pstmt.setString(5, user.getAddress());
			pstmt.setString(6, user.getCity());
			pstmt.setString(7, user.getState());
			pstmt.setString(8, user.getCountry());
			count = pstmt.executeUpdate();
			if (count > 0) {
				flag = true;
				return flag;
			}
			pstmt.close();
			return flag;

		}
	}
